package com.shop.wk.service;

import java.util.HashMap;
import java.util.List;
import java.util.Set;

/**
 * @author 日月星辰
 * @date 2020/12/26 19:21
 * @description
 */
public interface RedisService {

  /**
   * redis操作
   */
  public void set(String key, Object value, int seconds);

  public Object get(String key);

  public boolean delete(String key);

  //模糊查询
  List<Object> getByLike(String key);

  //模糊删除key 格式：key* 例如：key:*--key:123、key:abc 将被删除
  void likeDeleteKey(String keys);

  //Hash 哈希操作-----------------------------
  // 设置hash
  public void setHash(String hashKey, HashMap<String, Object> map, int seconds);

  //根据hash key 获取hashMap
  public HashMap<String, Object> getHash(String hashKey);

  //根据hash key与map key 获取map的value
  public Object getHash(String hashKey, String mapKey);

  //根据hash key获取hash中所有的key
  public Set<String> getHashKeys(String hashKey);

  //根据hash key获取hash中所有的value
  public List<String> getHashValues(String hashKey);

  //更新hash的某个map
  public void updateHash(String hashKey, String mapKey, Object mapValue);

  //删除hash某个map  可以多个mapKey参数
  public void deleteHash(String hashKey, Object... mapKeys);

  //判断是否存在某个hash
  public boolean hasHash(String hasKey,String mapKey);

}
